//
//  RecoderShareCardCell.m
//  QRMaster
//
//  Created by myApple on 15/7/29.
//  Copyright (c) 2015年 myApple. All rights reserved.
//

#import "RecoderShareCardCell.h"

@interface RecoderShareCardCell()
{
    UILabel * shareCardNameLabel;
    UILabel * fuckLabel;
    UILabel * shareCardTimeLabel;
    UIButton * shareStatusBtn;
    UILabel * shareMobileLabel;
}

@end

@implementation RecoderShareCardCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self prepareView];
    }
    return self;
}

-(void)prepareView
{
    float ScreenWidth = [UIScreen mainScreen].bounds.size.width;
    float x = 20;
    float y = 0;
    float width = ScreenWidth - x - 80;
    float height = 40;
    
    shareCardNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(x, y, width, height)];
    shareCardNameLabel.font = [UIFont systemFontOfSize:14.0];
    shareCardNameLabel.textColor = [UIColor blackColor];
    shareCardNameLabel.numberOfLines = 2;
    [self.contentView addSubview:shareCardNameLabel];
    
    y += height;
    height = 15;
    width = ScreenWidth - 20 - 40;
    shareMobileLabel = [[UILabel alloc]initWithFrame:CGRectMake(x, y, width, height)];
    shareMobileLabel.font = [UIFont systemFontOfSize:12.0];
    shareMobileLabel.textColor = RGBA(143, 147, 148, 1);
    [self.contentView addSubview:shareMobileLabel];
    
    
    y += height;
    height = 15;
    width = ScreenWidth - 20 - 40;
    shareCardTimeLabel = [[UILabel alloc]initWithFrame:CGRectMake(x, y, width, height)];
    shareCardTimeLabel.font = [UIFont systemFontOfSize:12.0];
    shareCardTimeLabel.textColor = RGBA(143, 147, 148, 1);
    [self.contentView addSubview:shareCardTimeLabel];
    
    x = ScreenWidth - 80;
    width = 80;
    y = 30;
    height = 20;
    shareStatusBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    shareStatusBtn.frame = CGRectMake(x, y, width, height);
    shareStatusBtn.titleLabel.font = [UIFont systemFontOfSize:13.0];
    [shareStatusBtn setBackgroundColor:RGBA(237, 238, 241, 1)];
    [self.contentView addSubview:shareStatusBtn];
    
}

-(void)setCommunityId:(NSString *)communityId
{
    _communityId = communityId;
}

-(void)setCommunityName:(NSString *)communityName
{
    _communityName = communityName;
}


-(void)setBulidingName:(NSString *)bulidingName
{
    _bulidingName = bulidingName;
}


-(void)setFloorName:(NSString *)floorName
{
    _floorName = floorName;
}

-(void)setShareMobile:(NSString *)shareMobile
{
    _shareMobile = shareMobile;
    shareMobileLabel.text = _shareMobile;
}

-(void)setRoomId:(NSString *)roomId
{
    _roomId = roomId;
}

-(void)setRoomName:(NSString *)roomName
{
    _roomName = roomName;
    shareCardNameLabel.text = [NSString stringWithFormat:@"%@ %@ %@ %@",_communityName,_bulidingName,_floorName,_roomName];
}

-(void)setBeginTime:(NSString *)beginTime
{
    _beginTime = beginTime;
}

-(void)setEndTime:(NSString *)endTime
{
    _endTime = endTime;
    shareCardTimeLabel.text = [NSString stringWithFormat:@"%@~%@",_beginTime,_endTime];
}

-(void)setStatus:(int)status
{
    _status = status;
    if (status == 0) {
        [shareStatusBtn setBackgroundColor:RGBA(237, 238, 241, 1)];
        [shareStatusBtn setTitle:NSLocalizedString(@"Overdue", nil) forState:0];
//        self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    }
    else
    {
        [shareStatusBtn setBackgroundColor:RGBA(125, 194, 52, 1)];
        [shareStatusBtn setTitle:NSLocalizedString(@"notExpired", nil)forState:0];
        self.accessoryType = UITableViewCellAccessoryNone;
    }
}


-(void)setShareId:(NSString *)shareId
{
    _shareId = shareId;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
